<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="java.sql.Connection"%>
<%@ page import="java.sql.Driver"%>
<%@ page import="java.sql.DriverManager"%>
<%@ page import="java.sql.ResultSet"%>
<%@ page import="java.sql.SQLException"%>
<%@ page import="java.sql.PreparedStatement"%>
<%@ page import="java.sql.Statement"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.List"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>注册界面</title>
</head>
<body>
	<%
		String name = request.getParameter("Username");
		if (name == null)
			name = "";
		String Password1 = request.getParameter("Password1");
		if (Password1 == null)
			Password1 = "";
		String Password2 = request.getParameter("Password2");
		if (Password2 == null)
			Password2 = "";
		System.out.println(name);
		out.println(Password1);
		out.println(Password2);
	%>
	用户名：<%=name%>
	<p></p>
	密码：<%=Password1%>
	<p></p>
	确认密码:<%=Password2%>
	<p></p>
	<a href="index2.jsp">登录页面</a>
	<%
		Class.forName("com.mysql.jdbc.Driver");
		String url = "jdbc:mysql://localhost:3306/jsp";
		String username = "root";
		String password = "root";
		Connection conn = DriverManager.getConnection(url, username, password);
		
		PreparedStatement ps=conn.prepareStatement("insert into tb_user(username, password) values(?,?)");
		ps.setString(1, name);
		ps.setString(2, Password1);
		ps.executeUpdate();
		
		/* Statement stmt = conn.createStatement();// 获取Statement */
		/* int rtn = stmt.executeUpdate("insert into tb_User(username,password)values('2','2')"); */
		conn.close();
	%>
</body>
</html>